home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / sound / sbf3.zip / FMTEST.C < prev    next >
C/C++ Source or Header  |  1993-09-19  |  961b  |  46 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "sb.h"
  4.  
  5. FM_Instrument instrument = {
  6.     {0x11, 0x01}, {0x8a, 0x40},
  7.     {0xf1, 0xf1}, {0x11, 0xb3},
  8.     {0x00, 0x00}, {0x06}, {0x00,
  9.     0x00, 0x00, 0x00, 0x00}
  10. };
  11.  
  12. /* Chromatic scale starting from C# */
  13. int notes[12] = {0x16B,0x181,0x198,0x1B0,0x1CA,0x1E5,
  14.                  0x202,0x220,0x241,0x263,0x287,0x2AE};
  15.  
  16. void main()
  17. {
  18.     if(Sb_Get_Params())
  19.     {
  20.         puts("BLASTER environment variable not set.");
  21.         exit(1);
  22.     }
  23.  
  24.     Sb_FM_Reset();
  25.  
  26.     Sb_FM_Set_Voice(0,&instrument);
  27.     Sb_FM_Set_Voice(1,&instrument);
  28.     Sb_FM_Set_Voice(2,&instrument);
  29.     Sb_FM_Set_Voice(3,&instrument);
  30.  
  31.     Sb_FM_Key_On(0,notes[11],2);
  32.     Sb_FM_Key_On(1,notes[3],3);
  33.     Sb_FM_Key_On(3,notes[6],3);
  34.     Sb_FM_Key_On(3,notes[11],3);
  35.  
  36.     (void) getchar();
  37.  
  38.     Sb_FM_Key_Off(0);
  39.     Sb_FM_Key_Off(1);
  40.     Sb_FM_Key_Off(2);
  41.     Sb_FM_Key_Off(3);
  42.  
  43.     Sb_FM_Reset();
  44. }
  45.  
  46.